package com.woniu.woniu_bx.controller;

import com.woniu.woniu_bx.pojo.Perm;
import com.woniu.woniu_bx.pojo.ResponseEntity;
import com.woniu.woniu_bx.service.PermService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author:GuoHai
 * @program: IntelliJ IDEA
 * @data: 2022/8/30 21:15
 */
@RestController
@RequestMapping("/admin/perm")
public class PermController {
    @Resource
    private PermService permService;

    @GetMapping("/findPerms/{id}")
    public ResponseEntity findPremsByRoleId(@PathVariable int id){
        List<Perm> permsList = permService.findPermsByRoleId(id);
        return ResponseEntity.SUCCESS("查找权限列表成功",permsList);
    }

    @GetMapping("/permList")
    public ResponseEntity findAllPrem(){
        List<Perm> permsList = permService.permList();
        return ResponseEntity.SUCCESS("查找权限列表成功",permsList);
    }
}
